﻿<%@ page language="java" import="java.util.*,ct.zxd.db.*" pageEncoding="utf-8"
contentType="text/html"
%>
<html lang="zh-cn">
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<title></title>
		<link rel="stylesheet" href="css/pintuer.css">
		<link rel="stylesheet" href="css/admin.css">
</head>

<%
	String shop = request.getParameter("shopid");
	Dao dao = new Dao();
	List<Map<String,Object>>list = dao.getTableByid("category", shop, null);	
	int count = 0;
	Map<String,Object> lastmap = null;
	if(list.size()>0) {
		lastmap = list.get(list.size()-1);
	}
	if(lastmap!=null){
		String showid = lastmap.get("show_id").toString();
		count = Integer.parseInt(showid);
	}
 %>

<body>
<div class="panel admin-panel">
  <div class="padding border-bottom">  
   <a class="button button border-yellow" onclick="window.location.href='#add'" href="addcategory.jsp?shop=<%=shop%>&flag=add&show=<%=count+1%>" target="add"><span class="icon-plus-square-o"></span> 添加</a>
  </div>
    <table class="table table-hover text-center">
    <tr>
      <th width="25%">编号</th>
      <th width="30%">名称</th>
      <th width="30%">操作</th> <!-- 操作部分宽度太短，按钮边线会重合 --> 
    </tr>
   <%
   	if(list!=null){
       for(Map<String,Object> map : list){
       		String showid = map.get("show_id").toString();
       		String cateName = map.get("name").toString();
       %>
	    <tr>
	      <td><%=showid%></td>     
	      <td><%=cateName%></td>     
	      <td><div class="button-group">
	      <a class="button border-main" onclick="window.location.href='#add'" href="addcategory.jsp?shop=<%=shop%>&show=<%=showid%>&cateName=<%= cateName%>&flag=update" target="add"><span class="icon-edit"></span> 修改</a>
	      <a class="button border-red" onclick="window.location.href='#add'" href="addcategory.jsp?shop=<%=shop%>&show=<%=showid%>&cateName=<%= cateName%>&flag=del" target="add"><span class="icon-trash-o"></span> 删除</a>
	      </div></td>
	    </tr>
    <%}}%>
    
  </table>
</div>

<div id="add" class="panel admin-panel margin-top">
  <iframe scrolling="auto" rameborder="0" src="addcategory.jsp?shop=<%=shop%>" name="add" width="100%" height="100%"></iframe>
</div>

</body>
</html>